package co.fitstart.entity.market;

import com.demo2do.core.utils.Alias;

/**
 * 
 * @author dan
 *
 */
@Alias("courseLevel")
public enum CourseLevel {
    
    PRIMARY("primary", "初级", "健身新秀"),
    
    MIDDLE("middle", "中级", "健身小咖"),
    
    SENIOR("senior", "高级", "健身老咖");
    
    private String alias;
    
    private String description;
    
    private String name;
    
    private CourseLevel(String alias, String description, String name) {
        this.alias = alias;
        this.description = description;
        this.name = name;
    }
    
    /**
     * 
     * @param alias
     * @return
     */
    public static CourseLevel aliasOf(String alias) {
        for (CourseLevel courseLevel : CourseLevel.values()) {
            if (courseLevel.getAlias().equalsIgnoreCase(alias)) {
                return courseLevel;
            }
        }
        
        return null;
    }
    
    /**
     * 
     * @param name
     * @return
     */
    public static CourseLevel nameOf(String name) {
        for (CourseLevel courseLevel : CourseLevel.values()) {
            if (courseLevel.getName().equalsIgnoreCase(name)) {
                return courseLevel;
            }
        }
        
        return null;
    }
    
    /**
     * 
     * @return
     */
    public boolean isPrimary() {
        return this.equals(PRIMARY);
    }
    
    /**
     * 
     * @return
     */
    public boolean isMiddle() {
        return this.equals(MIDDLE);
    }
    
    /**
     * 
     * @return
     */
    public boolean isSenior() {
        return this.equals(SENIOR);
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param alias the alias to set
     */
    public void setAlias(String alias) {
        this.alias = alias;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

}
